package edu.ynu.se.xiecheng.achitectureclass.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Where;
import org.hibernate.procedure.spi.ParameterRegistrationImplementor;

import javax.persistence.*;
import java.util.Set;

@Entity
@Getter
@Setter
@Where(clause = "is_deleted = 0")
public class Business extends LogicEntity{
    @Column
    private String businessName;

    @Column
    private String businessDescription;


    @Lob
    @Column(name = "image", columnDefinition = "BLOB")
    private byte[] image;

    @Column
    private int score;

    @Column
    private double deliveryFees;

    @Column
    private  double miniDeliveryFee;

    @Column
    private  int monthSold;

    @OneToMany(mappedBy = "business",
            fetch = FetchType.LAZY,
            cascade = CascadeType.ALL)
    @JsonIgnoreProperties("business")
    private Set<Commodity> commodities;

    @OneToMany(mappedBy = "business",
            fetch = FetchType.LAZY,
            cascade = CascadeType.ALL)
    @JsonIgnoreProperties("business")
    private Set<Order> orders;

}
